import {Base64} from "js-base64";
let comm = {};
const dates = [
  ['y','i','p','a','r','t','v','n','c','z','m'],//现在使用* TokenKey
  ['Q','N','P','T','V','U','M','A','B','X','O'],//暂定不用 HeaderToken
  ['b','q','w','o','i','c','R','T',')','H','M'],//暂定不用 Token
  ['@','^','u','p','k','F','%','E','L','P','W'],//暂定不用 HeaderTokens
  ['p','q','y','a',')','j','c','e','(','z','l'],//暂定不用 TokenKeys
  ['U','V','S','A',')','X','M','Z','P','E','G'],//暂定不用 Tokens
];
comm.token = (h)=>{
  let miao = String(new Date().getTime()).substring(0,8).split('');
  let box = [];
  for(let i in miao){
    box.push(dates[h][miao[i]])
  }
  return Base64.encode(box.join(''));
};
comm.headers = ()=>{
  return {
    'HeaderToken':comm.token(1),
    'TokenKey': comm.token(0),
    'Token':comm.token(2),
    'Tokens':comm.token(5),
    'HeaderTokens': comm.token(3),
    'TokenKeys':comm.token(4),
  }
};
export default comm;
